package controller;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

import multiformat.Calculator;


public class HistoryController extends JPanel implements ActionListener {

	private static final long serialVersionUID = 1L;

	private Calculator model;
	
	private JButton btnHistory;
	
	public HistoryController(Calculator model) {
		this.model = model;
	
		
		this.btnHistory = new JButton("show history");
		this.btnHistory.setBackground(Color.LIGHT_GRAY);
		
		this.add(btnHistory);

		
		//add actionlisteners to buttons
		this.btnHistory.addActionListener(this);
		
		this.validate();
		
		this.setVisible(true);
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == btnHistory) {
			model.showView("history");
		}
	}
}
